dollar
Type
keyword
Summary
The character $ (dollar sign) is used to indicate an environment variable on Unix systems and a command-line parameter on Unix or Windows systems.
Syntax
$
Description
Use the $ keyword to interact with the system environment and to find out what arguments were used if the application was started up from the command line.
The $ character marks two kinds of special variables: command-line arguments (on OS X, Unix, and Windows systems) and environment variables (on OS X and Unix systems).
If you start up the application from the command line (on OS X, Unix or Windows systems), the command name is stored in the global variable $0 and any arguments passed on the command line are stored in numbered variables starting with the $ character. For example, if you start the application by typing the following shell command:
myrevapp -h name
then the global variable $0 contains "myrevapp" (the name of the application), $1 contains "-h", and $2 contains "name".
If an argument includes spaces, it must be enclosed in quotes on the command line:
myrevapp -in \"new info.txt\" -out \"new info.xml\"
On Unix and OS X systems, a variable whose name begins with the $ character is exported to the application's environment, and is inherited by processes started up by the shell function or the open process command. Use this technique to create your own environment variables.
You can access existing environment variables by prepending the $ character to the environment variable's name. For example, the following statement gets the contents of the LOGNAME environment variable:
get $LOGNAME
Examples
put $LOGNAME into field "Login Name"
if $0 is not "myAppName" then answer "Problem initializing!"
Related
keyword: at
message: relaunch
command: open process
control structure: function, setProp
function: paramCount, shell
glossary: application, variable, command line, argument, command, Windows, environment variable, OS X, keyword, Unix, statement, process
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile